<!-- 
	공지사항
 -->
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>
<%@ page import="model.*" %>
<%
	String listName = "noticeList";
	ArrayList<Notice> boardList = new ArrayList<Notice>();
	if(request.getAttribute("noticeList") != null)
		boardList = (ArrayList<Notice>)request.getAttribute(listName);
	int studyId = ((Integer)request.getAttribute("studyId")).intValue();
	
	String checkValue =  (String)request.getAttribute("checkValue");
	if(checkValue==null){
		%>
		<script>
			location.href= "List.Notice?studyId=<%=studyId %>";
		</script>
		<%
		
	}
%>

<section class="studyBoard">
	<div class="col-md-6 col-md-offset-3 col-lg-6 col-lg-offset-3">
		<form method="post" action="New.Notice?studyId=<%=studyId%>">
			<button class="btn btn-default" type="submit">글쓰기</button>
		</form>
		<ul class="list-group">
			<%for(Notice notice : boardList) { %>
				<li class="list-group-item" onclick="showContent('<%=notice.getNoticeId()%>')">
					<div class="row">
						<div class="col-xs-4 col-md-3">
							<%=notice.getTitle() %>
						</div>
						<div class="col-xs-8 col-md-9">
							<%=notice.getMemid() %>
						</div>
					</div>
					<div class="" id='<%=notice.getNoticeId() %>' style="display:none;">
						<div class="panel-body">
							<%=notice.getContent() %>
						</div>
						<% if(notice.getMemid().equals(session.getAttribute("memid"))) { %>
							<button type="button" class="btn btn-default" onclick="modify('notice','<%=studyId %>', '<%=notice.getNoticeId() %>')">수정</button>
						<% } %>
					</div>
				</li>
			<%} %>
		</ul>
	</div>
</section>